/************************************************************************/
/* Read fbx file and Parse the date to render. 
/* Default AxisSystem is opengl 
/************************************************************************/
#ifndef Q_FBX_SCENE_H
#define Q_FBX_SCENE_H
#include "stdafx.h"
class CShader;
class CMeshFbx;
class CSceneFbx
{
public:
	CSceneFbx(void);
	~CSceneFbx(void);

	bool InitScene( const char * fileName = NULL );
	void DesdroyScene();

	bool LoadSceneFbx( const char * fileName );
	void DrawSceneFbx();

	KFbxScene * GetFbxScene() const { return m_pFbxScene; }

private:
	void FillCameraArray( KFbxScene * pScene, KArrayTemplate< KFbxNode *> & CameraArray );
	void FillCameraArrayRecursive( KFbxNode * pNode, KArrayTemplate< KFbxNode * > & CameraArray );

	void FillPoseArray( KFbxScene * pScene, KArrayTemplate< KFbxPose *> & PoseArray );
	void PreparePointCacheDate( KFbxScene * pScene );

	void LoadTextureFromFile( const KString & pFilePath, unsigned int & nTextureObject );
	void TriangulateRecursive( KFbxNode *pNode );
	// kfb loader all kinds of data
	void LoadCacheRecursive( KFbxNode * pNode, KFbxAnimLayer * pAnimLayer );
	void UnLoadCacheRecursive( KFbxNode * pNode = NULL );

	void LoadCacheRecursive( KFbxScene *pScene, KFbxAnimLayer * pAnimlayer, const char * pFbxFileName );
	void UnLoadCacheRecursive( KFbxScene * pScene );


	KFbxSdkManager				*m_pFbxManager;
	KFbxScene					*m_pFbxScene;

	KFbxAnimLayer				*m_pAnimLayer;
	KArrayTemplate<KString * >	m_AnimStackNameArray;
	KArrayTemplate<KFbxNode* >	m_CameraArray;
	KArrayTemplate<KFbxPose* >	m_PoseArray;

 	CShader						*m_pShader;

	typedef std::vector< CMeshFbx * >	MESHFBXLIST;
	MESHFBXLIST					m_pMeshList;
};

#endif


